home *** CD-ROM | disk | FTP | other *** search
- Path: mail2news.demon.co.uk!samtech.demon.co.uk
- From: Richard Samuels <Richard@samtech.demon.co.uk>
- Newsgroups: comp.lang.c
- Subject: Can anyone optimize this VERY simple piece of code?
- Date: Fri, 16 Feb 1996 11:43:30 +0000
- Organization: SAMtech PC Systems
- Message-ID: <19950700wnr@samtech.demon.co.uk>
- Reply-To: Richard@samtech.demon.co.uk
- X-NNTP-Posting-Host: samtech.demon.co.uk
- X-Newsreader: Newswin Alpha 0.9.1
- X-Mail2News-Path: disperse.demon.co.uk!post.demon.co.uk!samtech.demon.co.uk
-
- Hi, has anybody got any clues as to how I could optimize this little section
- of code?
- It is VERY simple but also VERY slow and I was just wondering if anybody has
- any ideas for speeding it up...
-
-
- void vga_putbackground(int startx, int starty, unsigned char huge *image)
- {
- //Variables:
- int x,y;
- unsigned int count;
- long bgoffs;
-
- //Code:
- //note: image[] is 2 screens in size (640x200) array...
- //...need routine to take current section only
- //...multiple calls can then create scrolling bground!
-
- //loop from beginning of screen buffer to end of screen buffer:
- count=0;
- for(y=starty;y<SCREENHEIGHT+starty;y++)
- for(x=startx;x<SCREENWIDTH+startx;x++)
- {
- //vga mem offset is just one continuous line.
- //bground offset is:
- bgoffs = (long) ((long)x+((long)y*640L));
-
- //copy bground mem to vga buffer:
- vgamem[count]=image[bgoffs];
- count++;
- }
- }
-
- If you could also e-mail me the reply it would be much appreciated.
- Thanks,
- Richard.
-